var _n30;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$zqcc_pageBase = require("zqcc_pageBase");
var s = cc__importDefault($1$zqcc_pageBase);
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
cc__decorator.property;
var def_PathTips = function (t) {
  function _ctor() {
    // 根据条件执行 t，并通过 arguments 传递参数
    const instance = (t !== null) ? t.apply(this, arguments) : this;

    // 初始化属性
    instance.startP = null;
    instance.nodestartp = null;

    return instance; // 返回实例
  }
  cc__extends(_ctor, t);
  _ctor.prototype.onLoad = function () { };
  _ctor.prototype.start = function () {
    this.init();
    this.node.on(cc.Node.EventType.TOUCH_START, this.Down, this);
    this.node.on(cc.Node.EventType.TOUCH_END, this.End, this);
    this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.End, this);
  };
  _ctor.prototype.Down = function (t) {
    var e = t.getLocation();
    this.startP = e;
    this.nodestartp = this.node.position;
    this.node.on(cc.Node.EventType.TOUCH_MOVE, this.Move, this);
    this.node.on(cc.Node.EventType.MOUSE_MOVE, this.Move, this);
  };
  _ctor.prototype.Move = function (t) {
    // 获取触摸位置
    const location = t.getLocation();

    // 更新节点位置
    this.node.x = this.nodestartp.x + location.x - this.startP.x;
    this.node.y = this.nodestartp.y + location.y - this.startP.y;

    // 限制节点的 x 坐标范围
    if (this.node.x > 375) {
      this.node.x = 375;
    } else if (this.node.x < -375) {
      this.node.x = -375;
    }
  };
  _ctor.prototype.End = function () {
    cc.log("end");
    if (this.node) {
      this.node.off(cc.Node.EventType.TOUCH_MOVE, this.Move, this);
      this.node.off(cc.Node.EventType.MOUSE_MOVE, this.Move, this);
    }
  };
  _ctor.prototype.init = function () { };
  _ctor.prototype.close = function () {
    this.node.destroy();
  };
  _ctor.prototype.onlyClose = function () {
    this.close();
  };
  _ctor.prototype.update = function () { };
  return cc__decorate([ccp_ccclass], _ctor);
}(s.default);
exports.default = def_PathTips;